home *** CD-ROM | disk | FTP | other *** search
- Path: info.uah.edu!oreo!gbacon
- From: gbacon@oreo (Greg Bacon)
- Newsgroups: comp.lang.c,comp.unix.shell,comp.unix.programmer,comp.unix.questions
- Subject: Re: 'getopt' problem..
- Followup-To: comp.lang.c,comp.unix.shell,comp.unix.programmer,comp.unix.questions
- Date: 6 Feb 1996 20:58:59 GMT
- Organization: The University of Alabama in Huntsville
- Message-ID: <4f8fej$nnk@info.uah.edu>
- References: <SRIDHAR_PANCHAPAKESAN.96Feb5162934@compton.tmai.com>
- Reply-To: gbacon@CS.UAH.Edu
- NNTP-Posting-Host: oreo.aspire.cs.uah.edu
- X-Newsreader: TIN [version 1.2 PL2]
-
- Sridhar Panchapakesan (sridhar_panchapakesan@tmai.com) wrote:
- : I am trying to use 'getopt' to read a quoted string as options for a
- : program. It works fine when I try it from a shell (csh) but when I try
- : running it from a script using 'exec' it does not accept the entire the
- : entire quoted string as the option.
-
- : e.g. ( test is the program name)
- : % test -f "-g -o 5" in.txt
- : ( getopt works fine. The string "-g -o 5" is read correctly into
- : optargs. Note that I have to use '-' (dash) in the string as a
- : requirement of the program itself.)
-
- : However when I try it from the script file:
-
- : exec test -f "\"-g -o 5\"" in.txt
-
- : The getopt only recognizes "-g as the option for -f instead of "-g -o
- : 5".
-
- : I would appreciate any help in this area..
-
- : - Sridhar.
-
- You do realize that test is a Bourne Shell built-in, don't you?
- Maybe you're after something like this:
-
- /path/to/your/test -f '-g -o 5' in.txt
-
- Hope this helps,
- Greg
- --
- Greg Bacon <gbacon@cs.uah.edu>
- University of Alabama in Huntsville
- CS Department Systems Support Team
-